<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.Date"%>
<%@ page import="com.joinway.framework.admin.core.constant.AdminWebConstants"%>
<%@ page import="org.apache.commons.lang3.time.DateFormatUtils" %>
<%@ page import="com.joinway.framework.admin.bean.UserContext" %>
<%
UserContext context = (UserContext)request.getSession().getAttribute(AdminWebConstants.USER_CONTEXT_KEY);
Date lastTime = context.getUser().getLastLoginTime();
String time = DateFormatUtils.format(lastTime, "yyyy年MM月dd日 HH时mm分ss秒");
%>
<style type="text/css">
#headbar{
	background: url('resources/images/header.png');
	background-repeat: repeat;
	height: 100%;
}
#headbar .pane {
	position: absolute;
	padding-top: 35px;
	font-size: 11px;
}
#headbar .lpane {
	left: 80px;
}
#headbar .rpane {
	right: 10px;
}
#headbar div img{
	width: 12px;
	height: 12px;
	padding-top: 3px;
	padding-right: 0px;
}
#headbar .bg{
	position: absolute;
	top:0;
	left:0;
	width:100%;
	height:100%;
}
#headbar .logo{
	position: absolute;
	width:50px;
	left:20px;
	top:5px;	
}
</style>
<script type="text/javascript">
$(function(){
	refreshHeader('${userContext.user.id}');
});

function logout(){
	showConfirmMessage('是否要退出系统？', function(r){
		if(r){
			window.location.href = 'logout.dox';
		}
	});
}
</script>
<div id="headbar">
	<img class="bg" src="resources/images/header.png">
	<img class="logo" src="resources/images/logo.png">
	<div class="lpane pane" align="left">
		<table>
			<tr>
				<td>欢迎</td>
				<th id="headbar_user_name"></th>
				<td>！</td>
				<td>您是第${loginCount}次登录，上次登录时间<%=time%></td>
			</tr>
		</table>
	</div>
	<div class="rpane pane" align="right">
		<table>
			<tr>
				<td><img alt="" src="/static/icons/role_large.png"></td>
				<th>用户权限</th>
				<td id="headbar_user_role"></td>
				<td>|</td>
				<td><a href="javascript:void(0)" onclick="logout()"><img alt="" src="/static/icons/logout_large.png"></a></td>
				<th><a href="javascript:void(0)" onclick="logout()">安全退出</a></th>
			</tr>
		</table>
	</div>
</div>
